#pragma once
#include<stdint.h>

typedef void* (*PipeLine)(void* obj, char* msg, int32_t len);
typedef struct
{
	const char* id;
	void* arg;
	int32_t ext;
	PipeLine streamLine;
	PipeLine out_to;
	PipeLine come_in;
} Pipe_t;
typedef Pipe_t* Pipe;

Pipe public_a_new_pipe(const char* id, void* arg, PipeLine stream, char pipe_type);
Pipe new_input_device(const char* id);
Pipe new_output_device(const char* id, void* arg, PipeLine stream);
int32_t remove_a_pipe(Pipe pipe, char pipe_type);
int32_t remove_a_pipe_by_name(char* pipe_name, char pipe_type);
int32_t pipe_connect_to(Pipe source, Pipe entry);
int32_t pipe_disconnect(Pipe source);
void* pipe_release_data(Pipe pipe, char* data, int32_t len);
int32_t cmd_pipe(int32_t n, char* arg[]);
Pipe pipe_find_source(const char* name);
Pipe pipe_find_entry(const char* name);
Pipe pipe_find_connected_entry(Pipe src);
Pipe pipe_find_connected_source(Pipe ent);
void pipe_show_connection(void);